<?

try{
    define('BASE_PATH', realpath(__DIR__).'/..');
    define('SANDBOX',false);
    
    
	include_once BASE_PATH.'/api/Autoload.php';
	
	Api\Autoloader::__initAutoloader(array(
                BASE_PATH.'/',
                BASE_PATH.'/api/',	
                BASE_PATH.'/admin/controller/',
				BASE_PATH.'/admin/model/',
				BASE_PATH.'/admin/view/',			
				BASE_PATH.'/site/controller/',
				BASE_PATH.'/site/model/',
				BASE_PATH.'/site/view/'
                ));
				
	Api\ObjectLoader::Load();

		
}catch(Exception $e)
{
  $config = Api\Config::Load();
  if($config['Debug'])
  {
        print "<pre>".$e->getMessage()."</pre>"."<pre>".$e->__toString()."</pre>";
        exit;
  }else
  {
        header('Location: http://'.$_SERVER['HTTP_HOST']);
  }
  unset($_SESSION);    
}

?>